/*
 * Lenovo Group
 * Copyright (c) 2015-2016 All Rights Reserved.
 * Project Name: lmrp-android app
 * Create Time: 16-2-16 下午6:31
 */

package com.lenovo.mso2o.rest;

import com.lenovo.framework.entity.AccessToken;
import com.lenovo.framework.entity.Res;
import com.lenovo.mso2o.entity.LogoutRequest;
import com.lenovo.mso2o.entity.TokenRequest;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
import rx.Observable;

public interface AuthAPI {

    @POST("oauth2/token/")
    Observable<Res<AccessToken>> getAccessToken(@Body TokenRequest loginRequest);

    @POST("oauth2/retoken")
    Call<Res<AccessToken>> refreshToken(@Body TokenRequest loginRequest);

    @POST("api/oauth2/logout")
    Call<Res> logout(@Field("geTuiCId") String cid);

    @POST("oauth2/logout")
    Observable<Res> logout(@Body LogoutRequest logoOutRequest);

    @POST("api/message/sendShortMessage")
    @FormUrlEncoded
    Call<Res> sendNumber(@Field("messageType") String type,
                            @Field("phone") String number,
                            @Field("message") String message);

    @POST("api/oauth2/modifyPass")
    @FormUrlEncoded
    Call<Res> changePassword(@Field("phone") String phonenumner,//手机号
                                @Field("password") String newpassword);//新密码

    /**
     * 获取验证码
     */
    @POST("api/oauth2/getCaptcha")
    @FormUrlEncoded
    Call<Res> getIdentifyCode(@Field("phone") String phoneNum);//手机号码

    /**
     * 匹配验证码
     */
    @POST("api/oauth2/verifyCaptcha")
    @FormUrlEncoded
    Call<Res> compareCode(@Field("captcha") String captcha,//验证码
                             @Field("phone") String phone);//手机号码

}
